<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="委托单" bodyClass="white-bg" libs=["bootstrapSelect"]/>
<style type="text/css">
    table{
        font-size: 13px;
        border-collapse: collapse;
        width: 100%;
        table-layout: fixed;
        text-align: center;
        color: #000000;
    }

    table img{
        width: 50px;
        height: 50px;
        float: left;
    }
    .order_ticket{
        width: 80%;
        margin: 0 auto;
    }
    .tooltip-inner{
        background: #fafafa !important; /*修改背景色*/
        text-align: center !important;/*字体左对齐*/
        color:#363636 !important;/*字体颜色*/
        max-width: 400px !important;
        color: red !important;
    }
    .tooltip-arrow{
        border-bottom-color: #fafafa !important;
        opacity: 0 !important;
    }
    .tooltip{
        opacity: 1 !important;

    }
    .order_ticket .table2 tr td:first-child{
        /* margin-left: 20px; */
        /* color: #122B40; */
        font-weight: bolder;
    }
    .table2{
        font-family: "open sans","Helvetica Neue",Helvetica,Arial,sans-serif;
        color: #676a6c;
    }
</style>
<div class="order_ticket" id ="addFinance">
    <@f.form id="task-form-complete" class="form-horizontal">
    <input name="entrustTotal" value="${total}" type="hidden">
    <input name="entrustTitle" value="" type="hidden">
    <table>
        <tr>
            <td colspan="4">
                <img src="Snipaste_2021-07-11_15-04-55.png" >
            </td>
            <td colspan="35"></td>
            <td colspan="4">湘质监统编施2020</td>
        </tr>
        <tr>
            <td colspan="43" id="et">

                <h1>原材料、试块、试件见证取样送检委托书</h1></td>
        </tr>
        <tr>
            <!--<td colspan="4">工程名称：</td>-->
            <td colspan="11">
                <@f.tableselect checked=false keyId="projectName" keyName="projectName" keyId="projectName" url="/pms/participant/list"
                name="projectName" boxTitle="甲方" tableInfo = "[{field:'participantCode',title:'参建编号'},
                {field:'participantName',title:'参建名称'}, {field:'projectName',title:'工程名称'}]" placeholder="请选择工程名称" />
            </td>
            <td colspan="2"></td>
            <td colspan="4">抗震等级：</td>
            <td colspan="4"><@f.input id="grade" name="grade" placeholder="抗震等级"/></td>
            <td colspan="2">
            </td>
            <!--<td colspan="4">2021年 07月 05日</td>-->
            <td colspan="11">
                <@f.input name="entrustTime" type="date" dataType="date" dataFormat="yyyy-MM-dd HH:mm:ss"
            placeholder="委托日期" butClass="fa fa-calendar-plus-o" required=true />
            </td>
            <!--<td colspan="4">编号</td>-->
            <td colspan="4">编号</td>
            <td colspan="7">
                <input name="entrustCode" value="${title}" type="text" class="form-control" readonly>
            </td>
        </tr>
    </table>

    <table class="table2 table table-hover table-bordered">
        <tr>
            <td colspan="11" >产品(含砼、砂浆试块及焊接件等)名称：</td>
            <!--<td colspan="6">水泥</td>-->
            <input name="productName" value="" type="hidden">
            <td colspan="9">
                <@f.treeselect name="productId" boxTitle="请选择名称" url="pms/test/treeData"
                expandLevel=true
                placeholder="请选择名称"/>

            </td>
            <form>
                <td colspan="5">
                    <input type="text" class="form-control" readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control" readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control" readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="11">规格型号</td>
            <td colspan="9"><@f.input id="specs" name="specs"/>
                <!--<input name ="specs" v-model="specs" value="specs">-->
            </td>
            <form>
                <td colspan="5">
                    <input type="text" class="form-control" readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control" readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control" readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="11">出厂批(炉、编)号</td>
            <td colspan="9"><@f.input id="samples" name="samples"/></td>
            <form>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="11">进场批量(吨、个、件)</td>

            <td colspan="9">
<!--                    <label class="sr-only" for="exampleInputAmount">Amount (in dollars)</label>-->
                    <div class="input-group">
                        <input type="text" id="in" style="width: 100%" class="form-control" data-toggle="tooltip" data-placement="top" title="" id="batch"  name="batch" placeholder="请输入">
                        <div class="input-group-addon">
                            <select style="border: none">
                                <option>吨</option>
                                <option>件</option>
                                <option>个</option>
                            </select>
                        </div>
                    </div>
            </td>

            <!--<td colspan="7">-->
                <!--<input type="text" id="batch"  name="batch" class="form-control"/>-->
            <!--</td>-->
            <!--<td colspan="2">吨</td>-->

            <form>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="11">有无出厂质量证明书</td>
            <td colspan="9"> <@f.radio name="certificate" dictType="pms_yes_no"/></td>
            <form>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="11">出厂质量等级</td>
            <td colspan="9"><@f.input id="qualityGrade" name="qualityGrade"/></td>
            <form>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="11">出厂日期</td>
            <td colspan="9"><@f.input name="productionTime" type="date" dataType="date" dataFormat="yyyy-MM-dd HH:mm:ss"
                placeholder="出厂日期" butClass="fa fa-calendar-plus-o" required=true /></td>
            <form>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="11">生产厂名</td>
            <td colspan="9"><@f.input id="factoryName" name="factoryName"/></td>
            <form>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="11">供应商名</td>
            <td colspan="9"><@f.input id="supplierName" name="supplierName"/></td>
            <form>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="11">样品编号</td>
            <td colspan="9">
            <input class="form-control" name="sampleCode" placeholder="自动生成" readonly >
            </td>
            <form>
                <td colspan="5">
                    <input type="text" class="form-control"readonly />
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="11">砼试样芯片编码或钢筋二维码、混合材种类</td>
            <form>
                <td colspan="9">
                    <@f.input id="other" name="other"/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="11">代表部位(层次、轴线)</td>
            <td colspan="9"><@f.input id="positions" name="positions"/></td>
            <form>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="11">样品重量</td>

            <td colspan="9">
                <input type="text" id="in1" style="width: 100%" class="form-control" data-toggle="tooltip"  name="sampleWeight" data-placement="top" title="">
            </td>

            <!--<td colspan="9"><@f.input id="sampleWeight" name="sampleWeight"/></td>-->

            <form>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="11">样品单件数</td>
            <form>

                <td colspan="9">
                    <input type="text" id="in2" style="width: 100%" name="sampleNum" class="form-control" data-toggle="tooltip" data-placement="top" title="">

                <!--<td colspan="9">-->
                    <!--<@f.input id="sampleNum" name="sampleNum"/>-->

                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="5">
                    <input type="text" class="form-control"readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="7">检验项目</td>
            <td colspan="28">
                <form action="" method="get">

                        <!--<div>-->
                            <!--<checkbox-group class="checkbox" v-model="list" >-->
                                <!--<label style="font-size:15px;" class="item" v-for="(item,i) in list" :key="i">-->
                                    <!--<checkbox :value="item.id" :checked="item.checked" >{{item.testingProject}}</checkbox>-->
                                <!--</label>-->
                            <!--</checkbox-group>-->
                            <!--&lt;!&ndash;<span>{{vo.inspectionItems}}</span><input type="checkbox" name="inspectionItems" v-bind:id="vo.id" v-bind:value="vo.inspectionItems" />&ndash;&gt;-->
                            <!--&lt;!&ndash;<checkbox :value="item.value" :checked="item.checked" >{{item.inspectionItems}}</checkbox>&ndash;&gt;-->
                        <!--</div>-->
                    <input name="inspectionItems" value="" type="hidden">
                    <label v-for="vo in list" v-bind:for="vo.id">

                        <div>
                            <input name="inspectionItems" value="" type="hidden">
                        <input v-model="vo.checked" type="checkbox" name="inspectionItemss" v-bind:id="vo.id" v-bind:value="vo.name" />
                        <span>{{vo.testingProject}}</span>
                        </div>
                    </label>

                    <!--<label><input name="inspection_item" type="checkbox" value="" />细度 </label>-->
                    <!--<label><input name="inspection_item" type="checkbox" value="" />标准稠度用水量</label>-->
                    <!--<label><input name="inspection_item" type="checkbox" value="" />凝结时间</label>-->
                    <!--<label><input name="inspection_item" type="checkbox" value="" />安定性</label>-->
                    <!--<label><input name="inspection_item" type="checkbox" value="" />快速法测定强度</label>-->
                    <!--<label><input name="inspection_item" type="checkbox" value="" />氯离子含量</label>-->
                </form>
            </td>
        </tr>
        <tr>
            <td rowspan="2" colspan="7" >检验标准</td>
            <td colspan="5" style="font-weight: bolder;">产品标准</td>
            <td colspan="23">
                <form action="" method="get">
                    <input name="productStandard" value="" type="hidden">
                    <label v-for="vo in list1" v-bind:for="vo.id">
                        <div>

                            <input v-model="vo.checked" type="checkbox" name="productStandards" v-bind:id="vo.id" v-bind:value="vo.name" />
                            <span>{{vo.name}}</span>
                        </div>
                    </label>
                    <!--<label><input name="product_standard" type="checkbox" value="" /> GB 175-2007（2018版）</label>-->
                    <!--<label><input name="product_standard" type="checkbox" value="" />GB 2938-2008</label>-->
                    <!--<label><input name="product_standard" type="checkbox" value="" />GB 25029-2010</label>-->
                    <!--<label><input name="product_standard" type="checkbox" value="" /> GB/T 201-2015 </label>-->
                    <!--<label><input name="product_standard" type="checkbox" value="" />GB/T 2015-2017</label>-->
                </form>
            </td>
        </tr>
        <tr>
            <td colspan="5">检验方法</td>
            <td colspan="23">
                <input name="testMethod" value="" type="hidden">
                <form action="" method="get">
                    <label v-for="vo in list2" v-bind:for="vo.id">
                        <div>

                            <input v-model="vo.checked"  type="checkbox" name="testMethods" v-bind:id="vo.id" v-bind:value="vo.name" />
                            <span>{{vo.name}}</span>
                        </div>
                    </label>
                    <!--<label><input name="test_method" type="checkbox" value="" /> GB/T 1346-2011）</label>-->
                    <!--<label><input name="test_method" type="checkbox" value="" />GB/T 1345-2005</label>-->
                    <!--<label><input name="test_method" type="checkbox" value="" />GB/T 208-2014</label>-->
                    <!--<label><input name="test_method" type="checkbox" value="" /> GB/T 8074-2008</label>-->
                    <!--<label><input name="test_method" type="checkbox" value="" />GB/T 2419-2005</label>-->
                    <!--<label><input name="test_method" type="checkbox" value="" /> GB/T 17671-1999 </label>-->
                </form>
            </td>
        </tr>
        <tr>
            <td colspan="7">焊工号</td>
            <form>
                <td colspan="10">
                    <@f.input id="welder" name="welder"/>
                </td>
                <td colspan="6">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="6">
                    <input type="text" class="form-control"readonly/>
                </td>
                <td colspan="6">
                    <input type="text" class="form-control"readonly/>
                </td>
            </form>
        </tr>
        <tr>
            <td colspan="7">取样人签名</td>
            <td colspan="28"><@f.input id="samplers" name="samplers"/></td>
        </tr>
        <tr>
            <td colspan="7">见证人（专业监理工程师）签名</td>
            <td colspan="28"><@f.input id="witness" name="witness"/></td>
        </tr>
        <tr>
            <td colspan="7">收样人签名</td>
            <td colspan="11"><@f.input id="collect" name="collect"/></td>
            <td colspan="5" style="font-weight: bolder;">样品处理方式及签字</td>
            <td colspan="12">
                <@f.radio name="sampleHandle" dictType="pms_mode" value=""/>
                <!--<form action="" method="get">-->
                    <!--&lt;!&ndash;<label><input name="isSignature" type="radio" value="" />留存 </label>&ndash;&gt;-->
                    <!--&lt;!&ndash;<label><input name="isSignature" type="radio" value="" />丢弃 </label>&ndash;&gt;-->
                    <!---->

                <!--</form>-->
            </td>
        </tr>
        <tr>
            <td colspan="4">施工单位:</td>
            <td colspan="8"><@f.input id="constructionUnit" name="constructionUnit"/></td>
            <td colspan="2" style="font-weight: bolder;">电话</td>
            <td colspan="4"><@f.input id="constructionIphone" name="constructionIphone"/></td>
            <td colspan="5" style="font-weight: bolder;">检测单位:</td>
            <td colspan="12"><@f.input id="testingUnit" name="testingUnit"/></td>
        </tr>
        <tr>
            <td colspan="4">委托单位</td>
            <td colspan="14"><@f.input id="entrustUnit" name="entrustUnit"/></td>
            <td colspan="5" style="font-weight: bolder;">电话</td>
            <td colspan="12"><@f.input id="entrustIphone" name="entrustIphone"/></td>
        </tr>
        <tr>
            <td colspan="35">
                <span style="float: left; width: 100%; display: block; text-align: left;">取样说明:</span>

                <textarea  type="text" style="width: 100%; height: 120px; display: block; resize: none; border : none;" name="samplingExplain"></textarea>
                <span style="width: 100%; text-align: right; line-height: 30px; display: block;">监理（建设）项目部(章)</span>
                <span style="width: 25%; float: right; line-height: 30px; text-align: right; display: block;">
                    <@f.input name="sealTime" type="date" dataType="date" dataFormat="yyyy-MM-dd HH:mm:ss"
                placeholder="日期" butClass="fa fa-calendar-plus-o" required=true /></span>
                <!--<span style="width: 100%; text-align: right; display: block;">+B17:AJ35B6:AJ35</span>-->

            </td>
        </tr>
    </table>
    <div class="row" style="text-align: center; line-height: 60px; margin-top: -20px;" id="_addTab">
        <!--<button type="button" class="btn btn-sm btn-primary" onclick="opt.form.submit()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;-->
        <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;
        <button type="button" class="btn btn-sm btn-danger" onclick="opt.modal.closeTab()"><i class="fa fa-reply-all"></i><@ctx.i18n text = "关闭"/></button>
    </div>
    <div><span>注：1、施工单位应将本委托书及其检测试验报告一并归档；2、见证人签名处应加盖见证人单位章；3、《见证取样、封样、送检方法要求》见反面附录一。</span></div>
</div>
</@f.form>
<@footer>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script type="text/javascript">
    var prefix = baseURL + "pms/entrust";
    $(function () {
        $("#in").on("input", function () {
            var v = "需要送"+Math.ceil($(this).val()/60)+"批检批"
            if($(this).val()>60){
                $(this).css("color","red")
                $(this).attr('title',v).tooltip('fixTitle').tooltip("show")
                console.log("更改")
                $(this).tooltip("show")
            }else{
                $(this).css("color","#b39999")
                // $(this).tooltip("hide")
                $(this).attr('title'," ").tooltip('fixTitle').tooltip("show")
            }
        });
    });
    $(function () {
        $("#in1").on("input", function () {
            var v = "需要送"+Math.ceil($(this).val()/12)+"批检批"
            if($(this).val()>12){
                $(this).css("color","red")
                $(this).attr('title',v).tooltip('fixTitle').tooltip("show")
                console.log("更改")
                $(this).tooltip("show")
            }else{
                $(this).css("color","#b39999")
                // $(this).tooltip("hide")
                $(this).attr('title'," ").tooltip('fixTitle').tooltip("show")
            }
        });
    });
    $(function () {
        $("#in2").on("input", function () {
            var v = "需要送"+Math.ceil($(this).val()/3)+"批检批"
            if($(this).val()>3){
                $(this).css("color","red")
                $(this).attr('title',v).tooltip('fixTitle').tooltip("show")
                console.log("更改")
                $(this).tooltip("show")
            }else{
                $(this).css("color","#b39999")
                // $(this).tooltip("hide")
                $(this).attr('title'," ").tooltip('fixTitle').tooltip("show")
            }
        });
    });

    $(function() {
        $("#batch").bind('input propertychange', function() {
            var a = $("#batch").val();

//             if(a/60<1){
//             }else {
//                 layer.open({content: '手机号码不正确，请重新输入',time: 2000, end:function(){

            if(a/60<=1){

            }else {
                layer.open({content: '1111',time: 2000, end:function(){


                    }});
            }

            console.log("11111111111")
            console.log(a)
            console.log("11111111111")

        })

    })

    var vm = new Vue({
        el: "#addFinance",
        data: {
            list: [],
            list1:[],
            list2:[],
            specs:'',

        }
    });


    $('#tipBut button').click(function(){
        $('#comment').text($(this).text())
    });

    $("#task-form-complete").validate({
        focusCleanup: true
    });

    function treeCallback(id, event, index, layero, nodes){
        console.log("aaaaaaaaaaaaaaa")
        if(id == "productId"){
            console.log("弹出表格选择===>>>>: id:" + id + "  event:" + event + " index:" + index + "  layero:"+ layero + " nodes:" + JSON.stringify(nodes));
            console.log(nodes);
            var data = nodes;
            console.log("111111222")
            console.log(data)
            //
            $("input[name=productName]").val(data.name);
            // $("input[name=level]").val(data.specifications2);
            var name=data.name
            console.log("11111")
            console.log(name)
            console.log("11111")
            var formdata = new FormData();
            formdata.append("productName", name);
            opt.common.sendAjax({
                url: prefix + "/getEntrustList",
                data: formdata,
                type: "POST",
                processData: false,
                contentType: false,
                success: function(result) {
                    console.log("55555");
                    console.log(result);
                    console.log(result.data);
                    console.log(result);

                   var arr=result.data;
                    console.log("1111111111");
                    console.log(arr);
                    console.log(arr);

                    console.log(vm);
                    console.log(vm);
                    console.log(vm);
                    $("input[name=specs]").val(arr.configure.specifications1);

                    for(var i=0; i<arr.standard.length; i++){
                        arr.standard[i].checked = false;
                    }
                    vm.$data.list = arr.standard;

                    for(var i=0; i<arr.product.length; i++){
                        arr.product[i].checked = false;
                    }
                    vm.$data.list1 = arr.product;

                    for(var i=0; i<arr.method.length; i++){
                        arr.method[i].checked = false;
                    }
                    vm.$data.list2 = arr.method;
                    // vm.$data.specs =arr.specifications1;

                }
            })
        }
    }
    window.onload=function(){
        // var Ohs=document.getElementById("et");
        // var text=Ohs.children[i].innerText;
        var Ohs= document.getElementById('et')
        var text=Ohs.children[0].innerText;
        $("input[name=entrustTitle]").val(text);
    }

    function submitHandler() {
        console.log("222222222222222222")
        console.log(vm.$data.list);


        var standard = [];
        for(var i=0; i<vm.$data.list.length; i++){
            if(vm.$data.list[i].checked){
                standard.push(vm.$data.list[i].testingProject);
            }
        }
        $("input[name=inspectionItems]").val(standard);
        console.log(standard);
        var product = [];
        for(var i=0; i<vm.$data.list1.length; i++){
            if(vm.$data.list1[i].checked){
                product.push(vm.$data.list1[i].name);
            }
        }
        $("input[name=productStandard]").val(product);
        console.log(product);
        var method = [];
        for(var i=0; i<vm.$data.list2.length; i++){
            if(vm.$data.list2[i].checked){
                method.push(vm.$data.list2[i].name);
            }
        }
        $("input[name=testMethod]").val(method);
        console.log(method);



        // document.getElementById('et').innerHTML

        if (opt.validate.form()) {
            opt.operate.saveTab(prefix + "/add", $('#task-form-complete').serialize());
        }
    }





</script>
</@footer>
</@pageTheme>